from django.shortcuts import render,HttpResponse
from king_admin import king_admin


# Create your views here.
def index(request):
    return render(request,'kingadmin/index.html',{'table_list':king_admin.enabled_admins})




def show(request,appname,modelname):
    print(king_admin.enabled_admins)
    # query_set=
    if king_admin.enabled_admins[appname]:
        print("get")
        modeladmin = king_admin.enabled_admins[appname][modelname]
        model=modeladmin.model
        
        queryset=model.objects.all()
        print('in view1: %s'%(modeladmin))
        print('in view2: %s'%(model))

        return render(request,'kingadmin/showdetail.html',{'modeladmin':modeladmin})

    else:
        print("not get")
        return HttpResponse('404')

